package com.newlink.building.record.mvp

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.record.mvp.contract.Module_Record_SecurityRecordContract
import com.newlink.building.record.mvp.model.Module_Record_SecurityRecordModel

/**
 * @author wangyang
 * @date 2022/9/29
 * @description 记录-安防记录页面的Presenter
 */
class Module_Record_SecurityRecordPresenter :
    BasePresenter<Module_Record_SecurityRecordContract.Model, Module_Record_SecurityRecordContract.View>(),
    Module_Record_SecurityRecordContract.Presenter {

    override fun createModel(): Module_Record_SecurityRecordContract.Model? {
        return Module_Record_SecurityRecordModel()
    }

    override fun getSecurityRecordList(
        token: String,
        page: Int,
        limit: Int
    ) {
        mModel?.getSecurityRecordList(token, page, limit)?.ss(mModel, mView) { result ->
            if (result?.data != null) {
                mView?.getSecurityRecordListSuccess(result.data.total, result.data.list)
            } else {
                mView?.getSecurityRecordListFail()
            }
        }
    }
}